<!doctype html>
<html>

<head>
    <meta charset=utf-8>
    <title></title>
    <meta name="robots" content="noindex,nofollow">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="<?=Web_Path?>packs/layui/css/layui.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/font.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/style.css">
    <script src="<?=Web_Path?>packs/js/jquery.min.js"></script>
    <script src="<?=Web_Path?>packs/layui/layui.js"></script>
</head>

<body>
    <span class="layui-breadcrumb" >
        <a ><cite><i class="fa fa-map-marker"></i><?=L('tpl_01')?></cite></a>
        <a href="<?=site_url('opt/main')?>"><?=L('tpl_02')?></a>
        <a href="#"><?=L('tpl_03')?></a>
    </span>
    <table class="layui-table">
        <colgroup>
            <col width="90">
                <col width="90">
                    <col>
        </colgroup>
        <thead>
            <tr>
                <th><a href="<?=site_url('plugins')?>" class="selected"><?=L('tpl_04')?></a></th>
                <th><a href="<?=site_url('plugins/yun')?>" class="selected"><?=L('tpl_05')?></a></th>
                <th><?=vsprintf(L('tpl_06'),array(site_url('plugins/yun')))?></th>
            </tr>
        </thead>
    </table>
    <table class="layui-table">
        <thead>
            <tr>
                <th class="plu_cen"><?=L('tpl_07')?></th>
                <th class="plu_cen"><?=L('tpl_08')?></th>
                <th class="plu_cen"><?=L('tpl_09')?></th>
                <th class="plu_cen"><?=L('tpl_10')?></th>
                <th class="plu_cen phide"><?=L('tpl_11')?></th>
                <th class="phide"><?=L('tpl_12')?></th>
                <th ><?=L('tpl_13')?></th>
            </tr>
        </thead>
        <tbody>
            <?php $i=1; $mid=$v='' ; foreach ($dirs as $value) { 
				$setfile = CSCMS.$value[ 'name'].FGF.'setting.php';
                if(is_dir( './plugins/'.$value[ 'name']) && file_exists($setfile)){ 
                    $model = require_once($setfile); 
                    $row = $this->db->query("SELECT id,sid FROM ".CS_SqlPrefix."plugins where dir='".$value['name']."'")->row();
                    $install = '<i class="fa fa-close " style="color: red" ></i>';
                    $cmd='<a href="javascript:cscms.plub_opt(\''.site_url('plugins/install').'\',\''.$value['name'].'\',\'\');" class="layui-btn  layui-btn-mini">'.L('tpl_14').'</a><a href="javascript:cscms.plub_opt(\''.site_url('plugins/del').'\',\''.$value['name'].'\',\''.L('tpl_15').'\');" class="layui-btn layui-btn-danger  layui-btn-mini">'.L('tpl_16').'</a>';
                    if($row){
                        $install='<i class="fa fa-check colorl" ></i>';
                        $cmd = '<a href="'.site_url('plugins/setting').'?dir='.$value['name'].'" class="layui-btn layui-btn-mini">'.L('tpl_17').'</a>';
                        $cmd .= '<a class="layui-btn layui-btn-warm  layui-btn-mini phide" href="javascript:cscms.plub_opt(\''.site_url('plugins/clear').'\',\''.$value['name'].'\',\''.L('tpl_18').'\')">'.L('tpl_19').'</a>';
                        $cmd.='<a class="layui-btn layui-btn-danger  layui-btn-mini" href="javascript:cscms.plub_opt(\''.site_url('plugins/uninstall').'\',\''.$value['name'].'\',\''.L('tpl_20').'\')">'.L('tpl_21').'</a>'; 
                        $cmd.='<a class="layui-btn layui-btn-normal  layui-btn-mini phide" href="'.cscmslink($value['name']).'"target="_blank">'.L('tpl_22').'</a>'; 
                        $cmd.='<a class="layui-btn layui-btn-danger  layui-btn-mini phide" id="update_html_'.$model['mid'].'" style="display: none;" href="'.$this->csapp->url('plub/show/'.$model['mid'].'.html',array('v'=>$model['version'])).'#annex">'.L('tpl_23').'</a><a style="display: none;" class="layui-btn layui-btn-primary  layui-btn-mini phide" id="update_'.$model['mid'].'">'.L('tpl_24').'</a>'; 
                        
                        $mid.='#'.$model['mid']; 
                        $v.='#'.$model['version']; 
                    } 
                echo '
                    <tr id="'.$value['name'].'_p">
                        <td class="plu_cen">'.$i.'</td>
                        <td class="plu_cen">'.$model['name'].'</td>
                        <td class="plu_cen">'.$value['name'].'</td>
                        <td style="text-align: center;">'.$install.'</td>
                        <td class="plu_cen phide">'.$model['version'].'</td>
                        <td class="phide">'.$model['author'].'</td>
                        <td style="min-width: 80px">'.$cmd.'</td>
                    </tr>';
                 $i++; } } ?>
            </tbody>
        </table>
    <div class="footer">
        <?=vsprintf(L( 'bottom'),array( '{elapsed_time}', '{sql_queries}', '{memory_usage}'))?>
    </div>
    
</body>
<script src="<?=Web_Path?>packs/admin/js/cscms.js"></script>
<script>
    cscms.init();
//检测版块版本
function get_plub_up(_mid,_v){
    $.getJSON(parent.yun_url+"plub/version?mid="+_mid+"&v="+_v+"&callback=?",function(data) {
        if(data['str']=='no'){
            $('#update_'+_mid).remove();
        }else{
            $('#update_html_'+_mid).html('<?=L('tpl_25')?>'+data['str']);
            $('#update_html_'+_mid).show();
            $('#update_'+_mid).hide();
        }
    });
}
setTimeout(function(){
    var mid = "<?=$mid?>",
        v = "<?=$v?>";
    var strs = mid.split("#");
    var strs2 = v.split("#");
    for (var i = 1; i < strs.length; i++) {
        get_plub_up(strs[i], strs2[i]);
    }
},1000);
</script>
</html>
